//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类.demo1AND20;

public class demo9 {
    public demo9() {
    }

    public static void main(String[] args) {
        System.out.println(isPalindrome2(9999));
    }

    public static boolean isPalindrome(int x) {
        if (x >= 0 && x < 10) {
            return true;
        } else {
            String s = String.valueOf(x);
            int i = 0;

            for(int j = s.length() - 1; i < s.length() / 2; --j) {
                if (s.charAt(i) != s.charAt(j)) {
                    return false;
                }

                ++i;
            }

            return true;
        }
    }

    public static boolean isPalindrome2(int x) {
        if (x >= 0 && x < 10) {
            return true;
        } else if (x < 0) {
            return false;
        } else {
            int count = 0;

            for(int temp = x; temp != 0; ++count) {
                temp /= 10;
            }

            int var4 = x;

            for(int i = 0; i < count / 2; ++i) {
                if ((int)((double)var4 / Math.pow((double)10.0F, (double)(count - 1 - i))) != (int)((double)x / Math.pow((double)10.0F, (double)i) % (double)10.0F)) {
                    return false;
                }

                var4 = (int)((double)var4 % Math.pow((double)10.0F, (double)(count - 1 - i)));
            }

            return true;
        }
    }

    public static boolean isPalindrome3(int x) {
        if (x >= 0 && x < 10) {
            return true;
        } else if (x < 0) {
            return false;
        } else {
            int temp = x;

            int xreverse;
            for(xreverse = 0; temp != 0; temp /= 10) {
                xreverse = xreverse * 10 + temp % 10;
            }

            return x == xreverse;
        }
    }
}
